package com.wankuma.hcm.midlet.metwit;

import METwit;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.List;

public class ChangeTimeLineScreen extends List implements CommandListener {
	Command cmdChange = new Command("選択", Command.OK, 0);
	Command cmdCancel = new Command("取消", Command.CANCEL, 100);
	
	TimeLineOperation.Callback callBack;
	
	public ChangeTimeLineScreen(TimeLineOperation.Callback cb, int tlid){
		super("ﾀｲﾑﾗｲﾝ選択", List.IMPLICIT);
		
		callBack = cb;
		
		this.addCommand(cmdChange);
		this.addCommand(cmdCancel);
		this.setCommandListener(this);
		
		this.append("友達ﾀｲﾑﾗｲﾝ(Friends)", null);
		this.append("返信ﾀｲﾑﾗｲﾝ(Replies)", null);
		this.append("履歴ﾀｲﾑﾗｲﾝ(Archive)", null);
		this.append("公開ﾀｲﾑﾗｲﾝ(Public)", null);
		this.append("受信ﾀﾞｲﾚｸﾄﾒｯｾｰｼﾞ(Recieved)", null);
		this.append("送信ﾀﾞｲﾚｸﾄﾒｯｾｰｼﾞ(Sent)", null);
		
		this.setSelectedIndex(tlid - 1, true);
	}

	public void commandAction(Command c, Displayable d) {
		if(c == cmdChange || c == List.SELECT_COMMAND){
			callBack.gotTimeLineAction(this.getSelectedIndex() + 1, -1);
		}
		Display display = METwit.getDisplay();
		MainScreen mscr = METwit.getMainScreen();
		display.setCurrent(mscr);
	}
}
